#include <bits/stdc++.h>
using namespace std;
int n,a[105],m,cnt = 0;
int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		m+=a[i];
	}
	m /= n;
	for(int i = 1; i <= n; i++) {
		if(a[i] == m) continue;
		else if(a[i] > m) {
			a[i+1] += (a[i] - m);
		} else if(a[i] < m){
			a[i+1] -= (m - a[i]);
			a[i] = m;
		}
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}
